<template>
  <div id="app">
    <router-view></router-view>
	<div id="navBottom">
		<ul>
			<li v-for="(item,index) in navList" :key="index"  @click="pushShow(item.name),selecteIndex = index">
				<div class="icon" :style="{backgroundImage:'url('+(index == selecteIndex?item.selectIcon:item.icon)+')'}" ></div>
				<div >
					<span class="font" :style="{color:index==selecteIndex?'blue':'black'}">{{item.name}}</span>
				</div>
			</li>
		</ul>
	</div>
  </div>
</template>

<script>
	export default{
		data(){
			return{
				selecteIndex:0,
				navList:[
					{path:'/home',name:'首页',icon:'./home.png',selectIcon:'./home_selected.png'},
					{path:'/category',name:'分类',icon:'./category.png',selectIcon:'./category_selected.png'},
					{path:'/profile',name:'我的',icon:'./profile.png',selectIcon:'./profile_selected.png'}
				]
			}
		},
		methods:{
			pushShow(name){
				this.$router.push({name:name});
			}
		},
		created() {
			
		}
	}
</script>

<style lang="scss">
	*{
		list-style: none;
	}
	#app{
		position:absolute;
		top: 0;
		left: 0;
		right: 0;
		bottom: 0;
		#navBottom{
			position: fixed;
			width: 100%;
			height: 60px;
			background:white;
			border-top:1px solid lightgray;
			bottom: 0;
			display: flex;
			flex-direction: row;
			justify-content: center;
			align-content: center;
			ul{
				height: 100%;
				display: flex;
				width: 100%;
				box-sizing: border-box;
				line-height: 60px;
				li{
					width:100%;
					height: 100%;
					text-align: center;
					padding-right: 10px;
					box-sizing: border-box;
					display: flex;
					flex: 1;
					.icon{
						position: relative;
						left: 39px;
						top: 5px;
						width: 22px;
						height: 22px;
						display: flex;
						background-size:cover;
						justify-content: center;
					}
					.font{
						font-size: 14px;
						position: relative;
						top: 10px;
						left: 15px;
					}
				}
				
			}
		}
		.container {
			width: 100%;
			height: auto;
		
			.commodity {
				width: 100%;
				height: auto;
				margin-top: 5px;
		
				.commodityBox {
					width: 100%;
					height: 150px;
					border-top: 1px solid lightgray;
					background: white;
					display: flex;
		
					.commodityImg {
						width: 55%;
						height: 100%;
						display: flex;
						align-items: center;
						padding: 8px;
						box-sizing: border-box;
					}
		
					.commodityText {
						width: 100%;
						height: 100%;
						font-size: 15px;
						padding: 10px;
						box-sizing: border-box;
		
						.commodityTextTitle {
							width: 200px;
							height: 29px;
							display: block;
							text-overflow: ellipsis;
							overflow: hidden;
						}
		
						.commodityTextPrice {
							width: 200px;
							display: block;
							text-overflow: ellipsis;
							overflow: hidden;
							white-space: nowrap;
							color: red;
							margin-top: 20px;
						}
		
						.commodityTextBottom {
							width: 100%;
							font-size: 12px;
							display: flex;
							margin-top: 40px;
							color: gray;
							position: relative;
						}
					}
				}
			}
		}
	}
</style>
